﻿using System;
using System.Configuration;
using System.Web.Profile;

namespace NWebMock
{
    public interface IProfileBase
    {
        #region Properties

        /// <summary>
        /// Gets the associated settings context.
        /// </summary>
        SettingsContext Context { get; }

        /// <summary>
        /// Gets a value indicating whether the user profile is for an anonymous user.
        /// </summary>
        bool IsAnonymous { get; }

        /// <summary>
        /// Gets a value indicating whether any of the profile properties have been modified.
        /// </summary>
        bool IsDirty { get; }

        /// <summary>
        /// Gets a value indicating whether access to the object is synchronized (thread safe). 
        /// </summary>
        bool IsSynchronized { get; }

        /// <summary>
        /// Gets or sets a profile property value indexed by the property name.
        /// </summary>
        /// <param name="propertyName">The name of the profile property.</param>
        /// <returns>The value of the specified profile property, typed as object.</returns>
        Object this[string propertyName] { get; set; }

        /// <summary>
        /// Gets the most recent date and time that the profile was read or modified.
        /// </summary>
        DateTime LastActivityDate { get; }

        /// <summary>
        /// Gets the most recent date and time that the profile was modified.
        /// </summary>
        DateTime LastUpdatedDate { get; }

        /// <summary>
        /// Gets a collection of settings property values.
        /// </summary>
        SettingsPropertyValueCollection PropertyValues { get; }

        /// <summary>
        /// Gets a collection of settings providers.
        /// </summary>
        SettingsProviderCollection Providers { get; }

        /// <summary>
        /// Gets the user name for the profile.
        /// </summary>
        string UserName { get; }

        #endregion

        #region Methods

        /// <summary>
        /// Gets a group of properties identified by a group name.
        /// </summary>
        /// <param name="groupName">The name of the group of properties.</param>
        /// <returns>A ProfileGroupBase object for a group of properties configured with the specified group name.</returns>
        ProfileGroupBase GetProfileGroup(string groupName);

        /// <summary>
        /// Gets the value of a profile property.
        /// </summary>
        /// <param name="propertyName">The name of the profile property.</param>
        /// <returns>The value of the specified profile property, typed as object.</returns>
        Object GetPropertyValue(string propertyName);

        /// <summary>
        /// Updates the profile data source with changed profile property values.
        /// </summary>
        void Save();

        /// <summary>
        /// Sets the value of a profile property.
        /// </summary>
        /// <param name="propertyName">The name of the property to set.</param>
        /// <param name="propertyValue">The value to assign to the property.</param>
        void SetPropertyValue(string propertyName, Object propertyValue);

        #endregion
    }
}
